import request from '@/utils/request'

export function uploadFile(data) {
  const formData = new FormData()
  
  // 添加文件
  formData.append('file', data.file)
  
  // 添加其他参数
  if (data.title) {
    formData.append('title', data.title)
  }
  if (data.description) {
    formData.append('description', data.description)
  }
  if (data.status !== undefined) {
    formData.append('status', data.status)
  }

  return request({
    url: '/v1/photo/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
} 